/*
 * @Descripttion: 
 * @Author: junhuafly
 * @Date: 2020-02-28 09:45:23
 * @LastEditors: junhuafly
 * @Email: junhuafly@163.com
 * @LastEditTime: 2020-03-11 16:57:42
 */
// components/swiper/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    images: {
      type: Array,
      value: []
    },
    src: String,
  },

  /**
   * 组件的初始数据
   */
  data: {
    indicatorDots: true,
    vertical: false,
    autoplay: true,
    interval: 2000,
    duration: 500,
    widHeight: '',
    current: 1,
    loadMask: true
  },
  /**
   * 组件的方法列表
   */
  ready() {},
  methods: {
    onClickHide() {
      this.setData({
        loadMask: false
      })
    },
    loadImage({
      detail
    }) {
      if (this.data.widHeight) return
      const {
        height,
        width
      } = detail
      wx.getSystemInfo({
        success: (res) => {
          this.setData({
            loadMask: false,
            widHeight: res.windowWidth / width * height + 'px'
          });
        }
      })
    },
    swiperChange({
      detail
    }) {
      const current = detail.current + 1
      this.setData({
        current
      })
    }
  }
})